//
//  DuanZiTableViewCell.m
//  TT
//
//                       .::::.
//                     .::::::::.
//                    :::::::::::  fuck me
//                 ..:::::::::::'
//              '::::::::::::'
//                .::::::::::
//           '::::::::::::::..
//                ..::::::::::::.
//              ``::::::::::::::::
//               ::::``:::::::::'        .:::.
//              ::::'   ':::::'       .::::::::.
//            .::::'      ::::     .:::::::'::::.
//           .:::'       :::::  .:::::::::' ':::::.
//          .::'        :::::.:::::::::'      ':::::.
//         .::'         ::::::::::::::'         ``::::.
//     …:::           ::::::::::::'              ``::.
//    ```` ':.          ':::::::::'                  ::::..
//                       '.:::::'                    ':'````..
//
//
//  Created by lanou3g on 15/6/6.
//  Copyright (c) 2015年 苏红召. All rights reserved.
//

#import "DuanZiTableViewCell.h"



@implementation DuanZiTableViewCell



-(void)setDuanzi:(DuanZi *)duanzi{
   
    
    _content.text = [NSString stringWithFormat:@"     %@",duanzi.content];
    CGRect rect = _content.frame;
    rect.size.height = [self textHeight:duanzi.content];
    _content.frame = rect;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        _content= [[UILabel alloc] initWithFrame:CGRectMake(20, 0, self.frame.size.width, self.frame.size.height)];
        _content.alpha = 0.5;
        _content.numberOfLines = 0;
        [self.contentView addSubview:_content];
        self.contentView.layer.cornerRadius = 10;
        self.contentView.backgroundColor = [UIColor grayColor];
    }
    return self;
}
-(CGFloat)textHeight:(NSString *)str{
    CGRect rect = [str boundingRectWithSize:CGSizeMake(304, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin attributes: @{NSFontAttributeName:[UIFont systemFontOfSize:17]} context:nil];
    
    return rect.size.height;
    
}

- (void)awakeFromNib {
    // Initialization code
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
